/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package basan.core;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Menno @ Basans
 */
public class EntityContainer {
    private static List<Entity> container;
    private static EntityContainer singleton;
    
    private EntityContainer() {
        container = new LinkedList<Entity>();
    }
    
    protected static EntityContainer getInstance() {
        if(singleton != null)
            return singleton;
        
        return new EntityContainer();
    }
    
    protected void updateAll() {
        for(Entity e : container) 
            e.update();
    }
    
    protected void thinkAll() {
        for(Entity e : container)
            e.think();
    }
    
    protected void lateUpdateAll() { 
        for(Entity e: container)
            e.lateUpdate();       
    }
    
    protected void addEntity(Entity entity) {
        container.add(entity);
    }
}
